package com.ruitu.health_1.dao.http;


import com.ruitu.health_1.dao.bean.Category;
import com.ruitu.health_1.dao.bean.Collect;
import com.ruitu.health_1.dao.bean.OrderDetail;
import com.ruitu.health_1.dao.bean.Pay;
import com.ruitu.health_1.dao.bean.StoreOrderItemList;
import com.ruitu.health_1.dao.bean.SubCommit;
import com.ruitu.router_module.bean.BaseResult2;
import com.ruitu.router_module.bean.PageModel2;
import com.ruitu.router_module.bean.article.Article;
import com.ruitu.router_module.bean.article.ArticleInfo;
import com.ruitu.router_module.bean.cart.Cart;
import com.ruitu.router_module.bean.cart.CouponList;
import com.ruitu.router_module.bean.extras.RongToken;
import com.ruitu.router_module.bean.extras.RongUser;
import com.ruitu.router_module.bean.order.ConfirmOrder;
import com.ruitu.router_module.bean.product.ChildrenCategory;
import com.ruitu.router_module.bean.product.Sku;
import com.ruitu.router_module.bean.user.Address;
import com.ruitu.router_module.bean.user.User;
import com.ruitu.router_module.bean.user.Wallet;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

public interface ApiService {
    //融云获取token接口
    @FormUrlEncoded
    @POST("getToken.json")
    Observable<RongToken> reqRongToken(
            @Header("App-Key") String appKey,
            @Header("Nonce") String Nonce,
            @Header("Timestamp") String Timestamp,
            @Header("Signature") String Signature,
            @Field("userId") String userId,
            @Field("name") String name,
            @Field("portraitUri") String portraitUri);

    // chat/getUserInfo 获取用户信息
    @GET("chat/getUserInfo")
    Observable<BaseResult2<RongUser>> reqUserInfo(@Query("accountId") String accountId);

    @Streaming
    @GET
    Observable<ResponseBody> downloadApk(@Url String url);

    // retrofit
    @Streaming
    @GET
    Call<ResponseBody> download(@Url String url);

    @GET("productCategory/list/withChildren")
    Observable<BaseResult2<List<Category>>> productCategory();

    @GET("productCategory/api/onlyFirst")
    Observable<BaseResult2<List<Category>>> onlyFirst();

    @GET("productCategory/api/onlyChildren")
    Observable<BaseResult2<List<ChildrenCategory>>> childrenCategory(@Query("id") String id);

    @POST("member/app/passwordLogin")
    Observable<BaseResult2<User>> login(@Body RequestBody body);

    @POST("member/app/codeLoginApp")
    Observable<BaseResult2<User>> loginyan(@Body RequestBody body);

    @POST("member/app/getCodeApp")
    Observable<BaseResult2> doyzm(@Body RequestBody body);

    @GET("article/api/getArticleListPage")
    Observable<BaseResult2<PageModel2<Article>>> getArticleListPage(@Query("pageSize") int pageSize, @Query("pageNum") int pageNum);

    @POST("member/app/register")
    Observable<BaseResult2> register(@Body RequestBody body);

    @GET("article/api/articleInfo")
    Observable<BaseResult2<ArticleInfo>> articleInfo(@Query("id") String id);

    @POST("member/api/token")
    Observable<BaseResult2<User>> autoLogin(@Body RequestBody body);

    @GET("cart/api/list")
    Observable<BaseResult2<List<Cart>>> cartList(@Query("memberId") String memberId);

    @POST("cart/app/delete")
    Observable<BaseResult2> deleteCart(@Body RequestBody body);

    @POST("order/app/generateConfirmOrder")
    Observable<BaseResult2<ConfirmOrder>> settlement(@Body RequestBody body);

    @POST("order/app/generateOrder")
    Observable<BaseResult2<Pay>> generateOrder(@Body RequestBody body);

    @GET("couponHistory/app/getCanUseCoupon")
    Observable<BaseResult2<List<CouponList>>> getCanUseCoupon(@Query("price") String price, @Query("memberId") String memberId);

    @POST("order/app/subOrder")
    Observable<BaseResult2<SubCommit>> subOrder(@Body RequestBody body);

    @POST("order/app/payOldOrder")
    Observable<BaseResult2<Pay>> payOldorder(@Body RequestBody body);

    @POST("member/address/api/add")
    Observable<BaseResult2> addAddress(@Body RequestBody body);

    @GET("member/address/api/list")
    Observable<BaseResult2<List<Address>>> addressList(@Query("memberId") String memberId);

    @POST("member/address/api/update")
    Observable<BaseResult2> updateAddress(@Body RequestBody body);

    @POST("member/address/api/delete")
    Observable<BaseResult2> deleteAddress(@Body RequestBody body);

    @GET("order/app/list")
    Observable<BaseResult2<PageModel2<StoreOrderItemList>>> orderList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("memberId") String memberId, @Query("status") String status);

    @GET("cart/api/getProduct")
    Observable<BaseResult2<List<Sku>>> getProductSku(@Query("productId") String productId);

    @POST("cart/api/update/attr")
    Observable<BaseResult2> updateSku(@Body RequestBody body);

    @GET("couponHistory/api/list")
    Observable<BaseResult2<PageModel2<CouponList>>> couponList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("memberId") String memberId, @Query("useStatus") String useStatus);

    @POST("member/app/edit")
    Observable<BaseResult2> userInfoEdit(@Body RequestBody body);

    @POST("member/api/changeHeadImg")
    Observable<BaseResult2> changeHeadImg(@Body MultipartBody body);

    @POST("cart/api/update/quantity")
    Observable<BaseResult2> changeQuantity(@Body RequestBody body);

    @POST("appPay/app/appPay")
    Observable<BaseResult2> balancePay(@Body RequestBody body);

    @GET("order/app/getOrder")
    Observable<BaseResult2<OrderDetail>> getOrder(@Query("memberId") String memberId, @Query("orderId") String orderId);

    @GET("order/app/getOrderItem")
    Observable<BaseResult2<OrderDetail>> getOrderItem(@Query("memberId") String memberId, @Query("orderItemIds") String orderItemId);

    @POST("order/api/cancelOrder")
    Observable<BaseResult2> cancelOrder(@Body RequestBody body);

    @POST("order/api/confirmReceipt")
    Observable<BaseResult2> confirmReceipt(@Body RequestBody body);

    @GET("collect/api/list")
    Observable<BaseResult2<PageModel2<Collect>>> collectList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("memberId") String memberId);

    @POST("comment/app/add")
    Observable<BaseResult2> comment(@Body RequestBody body);

    @POST("comment/app/multiUpload")
    Observable<BaseResult2<String>> multiUpload(@Body MultipartBody body);

    @POST("couponHistory/app/lock")
    Observable<BaseResult2> lock(@Body RequestBody body);

    @POST("couponHistory/app/unLock")
    Observable<BaseResult2> unLock(@Body RequestBody body);

    @POST("order/app/memberGoldLock")
    Observable<BaseResult2<String>> memberGoldLock(@Body RequestBody body);

    @POST("order/app/memberGoldUnLock")
    Observable<BaseResult2<String>> memberGoldUnLock(@Body RequestBody body);

    @GET("wallet/api/getInfo")
    Observable<BaseResult2<Wallet>> getWalletInfo(@Query("id") String id,@Query("type") String type);
}